package com.allianz.webapps.secondController;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.allianz.webapps.common.CustomerContextHolder;
import com.allianz.webapps.https.interfaces.type001.pojo.User;
import com.allianz.webapps.service.NotesCountService;

@RequestMapping(value="/notesCount")
@Controller
public class MyNotesCountController {
	
		@Autowired
		private  NotesCountService   countService;

		@RequestMapping(value="/getNotesCount")
		@ResponseBody
		public  Map<String,Object> getCount(HttpSession session){
			Map<String,Object> param = new HashMap<String, Object>();
			User user = (User) session.getAttribute("username");
			String  agent = user.getAgentId();
			long agentId = Long.parseLong(agent);
			//新业务
			CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_ALLIANZ);
			param.put("newPro", countService.policyNewProCount(agentId));
			//理赔
			CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_ALLIANZ);
			param.put("claim", countService.claimListCount(agentId));
			//质检
			CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_ALLIANZ);
			param.put("quality", countService.qualityListCount(agentId));
			//保全
			CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_ALLIANZ);
			param.put("mainten", countService.policyMaintenListCount(agentId));
			//新单回访
			CustomerContextHolder.setCustomerType(CustomerContextHolder.DATA_SOURCE_ALLIANZ);
			param.put("returnVisit", countService.policyReturnVisitCount(agentId));
			return param;
		}
}
